<?php
/**
 * 网站地图
 * @author cjli
 *
 */
class SitemapAction extends HomeAction
{
	public function index()
	{
    	
		$brandList = CategoryModel::get_category_list_base(CategoryModel::TYPE_BRAND);
		$categoryList = CategoryModel::get_category_list_base();
		$articleList = ArticleModel::get_article_list();
		
		$this->assign('brandList', $brandList);
		$this->assign('categoryList', $categoryList);
		$this->assign('articleList', $articleList);
		$this->display('sitemap_index');
	}
	
	
	public function product()
	{
		$cat_id = intval($_GET['catid']);
		if(! $categoryInfo = CategoryModel::get_category_info($cat_id)){
			redirect(url('sitemap/index'));
		}
		
		$productList = ProductModel::get_product_list(array('catid' => $cat_id));
		 $this->assign('productList', $productList);
		
    
    //当前路径
    $pathArray = array();
    if(isset($categoryInfo) && $categoryInfo){
    	$pathArray = CategoryModel::get_category_pos($cat_id);
    }
     $this->assign('pathArray', $pathArray);
     $this->assign('categoryInfo', $categoryInfo);
      
    $this->display('sitemap_product');
	}
}